<template> 
  <div class="app">
    <div class="com-news">
      <img
        src="../assets/images/news/logo8.jpg"
        alt="modification"
        style="width: 100%; height: 360px"
      />
    </div>
    <div class="tab-tit">
      <p><b>新闻中心</b></p>
      <span
        >您现在的位置 ->
        <a href="http://www.tzmc.com/newsInformation">新闻中心</a>
        ->公司新闻
      </span>
    </div>

    <div v-for="item in this.postsList[0]" :key="item.id" id="id">
      <h1 class="title">{{ item.titlezh }}</h1>
      <div class="time">本文创建时间：{{ item.time.substring(0, 10)}}</div>
      <div v-html="item.contentzh" class="rich_text"></div>
    </div>
  </div>
</template>
<script>
import axios from "axios";
export default {
  data() {
    return {
      page: 1,
      tabPosition: "left",
      postsList: []
    };
  },
  created() {
    this.getPostData();
    console.log(this.postsList[0]);
  },
  methods: {
    async getPostData() {
      let res = await axios.get("/api/api/new/" + this.$route.params.id)
        // console.log(res.data);
        // this.postsList = res.data;
        // console.log(this.postsList);
      this.postsList = res.data;
      console.log(this.postsList)
    },
  },
};
</script>
<style >
.com-news{
  padding-top: 70px;
}
.tab-tit {
    overflow: hidden;
    border-bottom: #333 1px dotted;
    padding: 12px;
    margin-bottom: 30px;
  }
  .tab-tit p {
    font-size: 50px;
    float: left;
  }
  .tab-tit span {
    padding-top: 55px;
    font-size: 20px;
    float: right;
  }
  .tab-tit span a {
    color: #333;
    text-decoration: none;
  }
  #id{
    text-align:center;
  }
.rich_text{
  display: flex;
    flex-direction: column;
    align-items: center;
}
.rich_text img {
  width: 100%;
}
@media screen  and (max-width: 1100px ) {
  .com-news img {
    width: 100%;
    height: 220px!important;
  }
}
@media screen  and (max-width: 730px) {
  .tab-tit p {
    font-size: 30px;
    padding-top: 20px;
    float: left;
  }
   .tab-tit span {
    padding-top: 12px;
    font-size: 16px;
    float: right;
  }
}
</style>